<template>
  <base-breadcrumb
    :title="titleName"
    class="topContainer"
  >
    <div class="app-container">
      <div class="container">
        <a-spin
          :spinning="progressing"
          :tip="progressingTips || '处理中...'"
        >
          <a-card>
            <div class="button-bar">
              <title-name title="施工进度总计划" />
              <!--<a-button type="primary" @click="action('undo')">保存信息</a-button>-->
              <!-- <a-button type="default" @click="action('undo')">回撤</a-button>
          <a-button type="default" @click="action('redo')">重做</a-button> -->
              <a-button
                type="primary"
                :disabled="type == 'view' || confirmLoadings || !selectedData"
                @click="importFromTemplate()"
              >
                导入模板
              </a-button>
              <a-button
                type="primary"
                :disabled="type == 'view' || confirmLoadings || !selectedData"
                @click="addSameNode"
              >
                新增同级节点
              </a-button>
              <a-button
                type="primary"
                :disabled="type == 'view' || confirmLoadings || !selectedData || selectedData.level === 4"
                @click="addNextNode"
              >
                新增下级节点
              </a-button>
              <!-- <a-button type="primary" @click="addModal()">新增节点</a-button> -->
              <a-button
                type="default"
                :disabled="
                  type == 'view' ||
                    confirmLoadings ||
                    !selectedData ||
                    selectedData.nodeOrder == '0' ||
                    selectedData.nodeOrder == '2'
                "
                @click="action('moveUp')"
              >
                上移
              </a-button>
              <a-button
                type="default"
                :disabled="
                  type == 'view' ||
                    confirmLoadings ||
                    !selectedData ||
                    selectedData.nodeOrder == '1' ||
                    selectedData.nodeOrder == '2'
                "
                @click="action('moveDown')"
              >
                下移
              </a-button>
              <a-button
                type="default"
                :disabled="type == 'view' || confirmLoadings || !selectedData || selectedData.level === 1"
                @click="action('outdent')"
              >
                升级
              </a-button>
              <a-button
                type="default"
                :disabled="
                  type == 'view' ||
                    confirmLoadings ||
                    !selectedData ||
                    selectedData.level === 4 ||
                    selectedData.nodeOrder === '2' ||
                    selectedData.nodeOrder === '0'
                "
                @click="action('indent')"
              >
                降级
              </a-button>
              <!--<a-button type="default" @click="action('undo')">回撤</a-button>-->
              <a-button
                type="default"
                :disabled="
                  type == 'view' ||
                    !selectedData ||
                    (selectedData.nodeOrder === '2' && selectedData.level === 1)
                "
                @click="action('del')"
              >
                删除节点
              </a-button>
              <!-- <a-button type="primary" @click="action('moveBackward')">减一天</a-button>
          <a-button type="primary" @click="action('moveForward')">加一天</a-button>
          <a-button type="primary" @click='exportToPDFs'>下载PDF</a-button> -->

              <a-button
                type="primary"
                @click="showDrawer()"
              >
                查看甘特图
              </a-button>
              <a-button
                v-btnPermission="'pm_008_ref_06'"
                type="primary"
                @click="refreshIndex()"
              >
                刷新序号
              </a-button>
              <div style="float: right">
                <a-button
                  :disabled="type == 'view' || confirmLoadings || type == 'approve'"
                  type="primary"
                  @click="saveDraft()"
                >
                  保存草稿
                </a-button>
                <a-button
                  :disabled="type == 'view' || confirmLoadings || type == 'approve'"
                  style="margin-left: 12px"
                  type="primary"
                  @click="submitForm()"
                >
                  提交
                </a-button>
                <a-button
                  type="default"
                  style="margin: 0 12px"
                  @click="goBack()"
                >
                  关闭
                </a-button>
              </div>
            </div>
            <!-- <a-button v-if="form.fileList" style="border:none;margin-bottom:10px"> -->

            <div style="border: none; margin-bottom: 10px; margin-left: 10px;">
              <upload-list
                :business-code="'PM12'"
                :edit-model="2"
                :text="text"
                :show-upload.sync="isClose"
                :upload-arrys.sync="form.fileList"
                :project-id="projectId"
                @fileArrysData="fileArrysData"
              />
            </div>

            <div class="pub-table-select-count">
              <a-icon
                type="info-circle"
                theme="twoTone"
              />
              <span style="margin-right: 12px">
                项目：<span class="totalNum">{{ total.projectName }} </span> | 节点共 ：<span class="totalNum">{{ total.nodeTotal || 0 }} 项
                </span>
                | 一级节点共<span class="totalNum">{{ total.firstNodeNum || 0 }} 项 </span> | 二级节点共<span class="totalNum">{{ total.secondNodeNum || 0 }} 项
                </span>
                | 三级节点共<span class="totalNum">{{ total.thirdNodeNum || 0 }} 项 </span> | 周期天数<span class="totalNum">{{ total.duration }}
                </span>
                | 周期间隔<span class="totalNum">{{ total.intervalTime }} </span>
              </span>
            </div>
            <!-- <a-table  row-key="nodeId" :scroll="{ x: 800, y: 600 }" -->
            <div class="gantt-layout">
              <!--<drag-modal v-if="visible" :visible="true" @cancel="visible=false">-->
              <drag-modal
                title="项目总计划甘特图"
                :visible="visible"
                @cancel="visible=false"
              >
                <template slot="footer">
                  <a-button
                    key="back"
                    @click="handleCancels"
                  >
                    关闭
                  </a-button>
                </template>
                <!--<a-drawer-->
                <!--ref="ganttDrawer"-->
                <!--title=""-->
                <!--placement="right"-->
                <!--:closable="false"-->
                <!--:z-index="10"-->
                <!--:get-container="false"-->
                <!--:body-style="{ padding: '0' }"-->
                <!--:wrap-style="{ position: 'absolute' }"-->
                <!--width="70%"-->
                <!--:after-visible-change="afterVisibleChange"-->
                <!--@close="onClose"-->
                <!--&gt;-->
                <gantt
                  ref="ganttCom"
                  class="left-container"
                  :columns="ganttColumns"
                  :plugins="plugins"
                  :tasks="tasks"
                  :heigh="ganttHeight"
                  @task-deleted="deleteTask"
                  @task-updated="logTaskUpdate"
                  @link-updated="logLinkUpdate"
                  @task-addModal="addModal"
                  @task-selected="selectTask"
                />
                <!--</a-drawer>-->
              </drag-modal>

              <umi-table
                ref="bigDataTable"
                show-header-overflow
                show-body-overflow
                :row-height="50"
                :height="540"
                :expand-icon-column-index="2"
                :tree-config="{
                  children: 'children',
                  expandAll: false,
                }"
                row-key="nodeId"
                row-id="nodeId"
                :use-virtual="true"
                border
                :row-class-name="rowClassNames"
                @row-click="handleClickRow"
              >
                <u-table-column
                  v-for="item in columns"
                  :key="item.dataIndex"
                  :prop="item.dataIndex"
                  :label="item.title"
                  :width="item.width"
                  :tree-node="item.dataIndex === 'name'"
                  align="center"
                >
                  <template v-slot="{ row }">
                    <div
                      v-if="item.scopedSlots"
                      :title="row[item.dataIndex]"
                    >
                      <div
                        v-if="item.dataIndex === 'index'"
                        class="table-form-box"
                      >
                        <span>{{ row.index }}</span>
                      </div>
                      <!--阶段/类别-->
                      <div
                        v-if="item.dataIndex === 'name'"
                        class="table-form-box"
                      >
                        <BaseTextarea
                          v-if="row.level != '4' && type == 'edit'"
                          v-model="row.name"
                          placeholder="请输入"
                          :auto-size="{minRows: 2, maxRows: 2}"
                          :show-limit-tip="false"
                          :show-stretch="false"
                          @blur="blurData"
                        />
                        <span v-else> {{ row.name }}</span>
                      </div>
                      <!--业务事项-->
                      <div
                        v-if="item.dataIndex === 'businessMatters'"
                        class="table-form-box"
                      >
                        <BaseTextarea
                          v-if="row.level == '4' && type == 'edit'"
                          v-model="row.businessMatters"
                          placeholder="请输入"
                          :auto-size="{minRows: 2, maxRows: 2}"
                          :show-limit-tip="false"
                          :show-stretch="false"
                          @blur="changeMatter"
                        />
                        <span v-else>{{ row.businessMatters }}</span>
                      </div>
                      <!-- 管控级别 -->
                      <div
                        v-if="item.dataIndex === 'controlLevelName'"
                        class="table-form-box"
                      >
                        <a-select
                          v-if="row.level == '4' && type == 'edit'"
                          v-model="row.controlLevelId"
                          :get-popup-container="getPopupContainer"
                          placeholder="请选择"
                          style="width: 100px"
                          @change="changeLevel"
                        >
                          <a-select-option
                            v-for="item in nodeList"
                            :key="item.controlLevelId"
                            :value="parseInt(item.controlLevelId)"
                          >
                            {{
                              item.controlLevelName
                            }}
                          </a-select-option>
                        </a-select>
                        <span v-else>{{ row.controlLevelName }}</span>
                      </div>
                      <!-- 周期 -->
                      <div
                        v-if="item.dataIndex === 'duration'"
                        class="table-form-box"
                      >
                        <BaseInputNumber
                          v-if="row.level == '4' && type == 'edit'"
                          v-model="row.duration"
                          placeholder="请输入"
                          :min="0"
                          :max="2000"
                          :is-int="true"
                          @blur="editduration"
                        />
                        <span v-else>{{ row.duration }}</span>
                      </div>
                      <!-- 计划开始时间 -->
                      <div
                        v-if="item.dataIndex === 'startTime'"
                        class="table-form-box"
                      >
                        <a-date-picker
                          v-if="row.level == '4' && type == 'edit'"
                          v-model="row.startTime"
                          placeholder="请输入"
                          :default-picker-value="moment('nowTime')"
                          @change="editstartDate"
                        />
                        <span v-else>{{ row.startTime }}</span>
                      </div>
                      <!--            完成标准-->
                      <div v-if="item.dataIndex === 'completeStandard'">
                        <div class="table-form-box">
                          <BaseTextarea
                            v-if="row.level == '4' && type == 'edit'"
                            v-model="row.completeStandard"
                            placeholder="请输入"
                            :auto-size="{minRows: 2, maxRows: 2}"
                            :show-limit-tip="false"
                            :show-stretch="false"
                            @blur="changecompleteStandard"
                          />
                          <span v-else>{{ row.completeStandard }}</span>
                        </div>
                      </div>
                      <!-- 验证资料 -->
                      <div
                        v-if="item.dataIndex === 'verifyDoc'"
                        class="table-form-box"
                      >
                        <BaseTextarea
                          v-if="row.level == '4' && type == 'edit'"
                          v-model="row.verifyDoc"
                          placeholder="请输入"
                          :auto-size="{minRows: 2, maxRows: 2}"
                          :show-limit-tip="false"
                          :show-stretch="false"
                          @blur="changeverifyDoc"
                        />
                        <span v-else>{{ row.verifyDoc }}</span>
                      </div>
                      <!-- 第一责任人 -->
                      <div
                        v-if="item.dataIndex === 'firstResponsible'"
                        class="table-form-box"
                      >
                        <div
                          v-if="row.firstResponsible"
                          style="display: flex;"
                        >
                          <!-- <div> -->
                          <a-tooltip
                            :title="infos"
                            @visibleChange="getDatas(row.firstResId)"
                          >
                            <span style="flex: 1;overflow: hidden;text-overflow:ellipsis;">{{ row.firstResponsible }}</span>
                          </a-tooltip>
                          <a
                            v-if="row.level == '4' && type == 'edit' && row.firstResponsible"
                            @click="handleBind(row)"
                          >(重新选择)</a>
                          <!-- </div> -->
                        </div>
                        <a
                          v-if="row.level == '4' && type == 'edit' && !row.firstResponsible"
                          @click="handleBind(row)"
                        >选择第一责任人</a>
                      </div>
                      <!-- 直接责任人 -->
                      <div
                        v-if="item.dataIndex === 'directResPerName'"
                        class="table-form-box"
                      >
                        <div style="display: flex;">
                          <a-tooltip
                            :title="posts"
                            @visibleChange="getPosts(row.directResPerId)"
                          >
                            <span style="flex: auto;overflow: hidden;text-overflow:ellipsis;">{{ row.directResPer && row.directResPer.label }}</span>
                          </a-tooltip>
                          <a
                            v-show="row.level == '4' && type == 'edit'"
                            @click.stop="toggleSelect(row, true)"
                          >(点击选择)</a>
                        </div>
                        <a-select
                          v-if="row.level == '4' && type == 'edit'"
                          v-show="row.showSelect"
                          :ref="'directSelect-' + row.index"
                          v-model="row.directResPer"
                          :get-popup-container="getPopupContainer"
                          label-in-value
                          placeholder="请选择"
                          style="width: 50%"
                          option-filter-prop="children"
                          show-search
                          @dropdownVisibleChange="dropdownVisibleChange($event, row)"
                          @select="toggleSelect(row, false)"
                          @change="changeResponse"
                        >
                          <a-select-option
                            v-for="item in responsLists"
                            :key="item.employeeId"
                            :value="item.employeeId"
                          >
                            {{ item.employeeName }}
                          </a-select-option>
                        </a-select>
                        <div v-else>
                          <a-tooltip
                            style="width: 100%;height: 400px;overflow: auto"
                            :title="posts"
                            @visibleChange="getPosts(row.directResPerId)"
                          >
                            <span>{{ row.directResPerName }}</span>
                          </a-tooltip>
                        </div>
                      </div>
                    </div>
                    <span
                      v-else
                      :title="row[item.dataIndex]"
                    >
                      {{ row[item.dataIndex] }}
                    </span>
                  </template>
                </u-table-column>
              </umi-table>
            </div>
          </a-card>
        </a-spin>
      </div>
      <task-template-modal
        :select-level="selectLevel"
        :visible="taskTemplateVisible"
        @hide="importFromTemplateHide"
        @dataImport="onTemplateDataImport"
      />
      <modal
        v-if="bindOrgVisible"
        :id="currentId"
        :form-data="form"
        :org-query="orgQuery"
        :screening="screening"
        :visible="true"
        @handleCancelFirstRes="handleCancelFirstRes"
        @handleOk="handleOk"
      />
    </div>
  </base-breadcrumb>
</template>
<script>
import { gantt } from 'dhtmlx-gantt'
import { getNodeControl } from '@/api/template'
import {
  getProjects,
  getconstructionPlan,
  editPlan,
  searchFiles,
  addDownNode,
  submitAudit,
  addSameNode,
  editNodePosition,
  deleteWork,
  importTemplate,
  refreshSort
} from '@/api/construction/planInput'
import Gantt from '../gantt/gantt'
import TaskTemplateModal from '../gantt/template-modal'
import locale from 'ant-design-vue/es/date-picker/locale/zh_CN'
import moment from 'moment'
import { getJobs, getStaffAll } from '@/api/subassembly/TreeSelectOrganization'
import { getOrganizePeopleList, getOrganizeUserList, getOrgUserPosts } from '@/api/commons'
import UploadList from '../progress/file'
import modal from '@/components/SelectJobs'
import Vue from 'vue' // 第一责任人
import { UTable, UTableColumn } from 'umy-ui'
import Template from './template.vue'
import DragModal from '@/components/DragModal'

const columns = [
  {
    title: '编号',
    width: 60,
    dataIndex: 'index',
    scopedSlots: { customRender: 'index' }
  },
  {
    title: '阶段/类别',
    align: 'center',
    dataIndex: 'name',
    scopedSlots: { customRender: 'name' },
    width: 375,
    ellipsis: true
  },
  {
    title: '业务事项',
    align: 'center',
    dataIndex: 'businessMatters',
    width: 300,
    scopedSlots: { customRender: 'businessMatters' },
    ellipsis: true
  },
  {
    title: '管控级别',
    align: 'center',
    dataIndex: 'controlLevelName',
    scopedSlots: { customRender: 'controlLevelName' },
    width: 150,
    ellipsis: true
  },
  {
    title: '周期',
    dataIndex: 'duration',
    align: 'center',
    width: 120,
    scopedSlots: { customRender: 'duration' },
    ellipsis: true
  },
  {
    title: '计划开始时间',
    dataIndex: 'startTime',
    align: 'center',
    width: 150,
    scopedSlots: { customRender: 'startTime' },
    ellipsis: true
  },
  {
    title: '计划完成时间',
    dataIndex: 'endTime',
    align: 'center',
    width: 120,
    ellipsis: true
  },
  {
    title: '完成标准',
    dataIndex: 'completeStandard',
    width: 420,
    align: 'center',
    scopedSlots: { customRender: 'completeStandard' },
    ellipsis: true
  },
  {
    title: '验证资料',
    dataIndex: 'verifyDoc',
    align: 'center',
    width: 300,
    scopedSlots: { customRender: 'verifyDoc' },
    ellipsis: true
  },
  {
    title: '第一责任人',
    align: 'center',
    dataIndex: 'firstResponsible',
    width: 480,
    scopedSlots: { customRender: 'firstResponsible' }
  },
  {
    title: '直接责任人',
    width: 350,
    align: 'center',
    dataIndex: 'directResPerName',
    scopedSlots: { customRender: 'directResPerName' },
    ellipsis: true
  }
]
export default {
  name: 'DhtmlxGantt',
  components: { DragModal, Gantt, TaskTemplateModal, UploadList, modal, umiTable: UTable, UTableColumn },
  data() {
    return {
      infos: [],
      posts: [],
      progressing: false,
      progressingTips: '处理中...',
      isClose: false,
      ganttHeight: 661,
      levelOption: '',
      disabled: false,
      uploadLists: [],
      tableData: [],
      ganttData: { data: [] },
      isGanttDataOk: false,
      titleName: '',
      startDates: '',
      indentSize: 15,
      type: '',
      locale,
      tasks: { data: [], links: [] },
      columns,
      templateId: '',
      addLevel: '',
      bindOrgVisible: false,
      rowSelection: {},
      resultData: {},
      saveSelectRows: [],
      ganttColumns: [],
      preTasks: [],
      currentId: '',
      selectLevel: '',
      total: {},
      projectId: '',
      loading: false,
      text: '上传业主/监理签确计划及双代号网络图',
      responsLists: [],
      taskType: 'task',
      modalTitle: '新增节点',
      confirmLoading: false,
      nodeList: '',
      addVisible: false,
      visible: false,
      selectId: '',
      taskTemplateVisible: false,
      plugins: {
        undo: true,
        drag_timeline: true
      },
      messages: [],
      selectedTask: null,
      rangeConfig: {
        rules: [{ type: 'array', required: true, message: '请选择计划日期!' }]
      },
      today: '2020-11-23',
      confirmLoadings: false,
      selectedData: null,
      orgQuery: {}, //搜索组织树参数
      screening: true,
      planId: '',
      form: {
        fileList: []
      },
      nowTime: this.getNowDate()
    }
  },
  beforeCreate() {
    this.form = this.$form.createForm(this, {})
  },
  watch: {
    tableData(list) {
      if (this.$refs.bigDataTable) {
        // 获取之前展开数据
        const expandRecords = this.$refs.bigDataTable.getTreeExpandRecords()
        // 获取之前滚动高度(表格实例上的scrollTop属性，在滚动到底部时会小于真实的scrollTop值，因此直接从dom获取真实滚动高度)
        const scrollTop = this.$refs.bigDataTable.tableExample().bodyWrapper.scrollTop
        // 加载数据
        this.$refs.bigDataTable.reloadData(list).then(() => {
          // 数据加载完成出现之后，打开之前的展开行
          expandRecords.forEach((row) => {
            this.$refs.bigDataTable.setTreeExpansion(row, true)
          })
          // 还原之前滚动高度
          this.$refs.bigDataTable.pagingScrollTopLeft(scrollTop)
        })
      }
    }
  },
  created() {
    this.today = moment().format('yyyy-MM-DD')
    const userInfo = Vue.getAcloudProvider().getUserInfo()
    this.currentId = userInfo.id
    this.planId = this.$route.query.planId
    this.templateId =
      this.$route.query.planId || localStorage.getItem('currentSelectMasterPlanId') || this.$route.query.id
    this.projectId = this.$route.query.projectId
    this.type = this.$route.query.type
    if (this.$route.fullPath == '/construction/addAdjustView') {
      this.type = 'view'
    }
    // setTimeout(()=>{
    //   this.getOrganizePeopleList()
    //   this.getNodeControl()
    //   this.searchFiles()
    // },2000)
    this.nowTime = this.getNowDate()
    this.getconstructionPlan(true)
    this.getOrganizePeopleList()
    localStorage.removeItem('task')
    localStorage.removeItem('link')
    this.tasks.data = []
    this.tasks.links = []
    this.ganttColumns = [
      {
        name: 'sortNum',
        label: '编号',
        align: 'center',
        resize: true,
        tree: false,
        width: 40,
        template: function (obj) {
          return obj.$index + 1
        }
      },
      {
        name: 'name',
        label: '阶段/类别',
        align: 'left',
        resize: true,
        tree: false,
        width: 140,
        template: function (obj) {
          return obj.text
        }
      }
    ]
    gantt.config.date_format = '%Y-%m-%d'
    const cfg = gantt.config
    const strToDate = gantt.date.str_to_date(cfg.date_format, cfg.server_utc)

    gantt.templates.parse_date = function (date) {
      return strToDate(date)
    }
    gantt.config.layout = {
      css: 'gantt_container',
      cols: [
        {
          min_width: 140,
          width: 140,
          rows: [
            { view: 'grid', scrollX: 'gridScroll', scrollable: true, scrollY: 'scrollVer' },
            { view: 'scrollbar', id: 'gridScroll', group: 'horizontal' }
          ]
        },
        { resizer: true, width: 1 },
        {
          rows: [
            { view: 'timeline', scrollX: 'scrollHor', scrollY: 'scrollVer' },
            { view: 'scrollbar', id: 'scrollHor', group: 'horizontal' }
          ]
        },
        { view: 'scrollbar', id: 'scrollVer' }
      ]
    }
  },
  mounted() {},
  methods: {
    /**
     * 选择框下拉菜单展开收起事件
     * @param {Boolean} visible true为展开，false为收起
     * @param {Object} data 行数据
     */
    dropdownVisibleChange(visible, data) {
      if (!visible) {
        this.toggleSelect(data, false)
      }
    },
    /**
     * 切换选择框的显示，如果是显示，那么自动点击，打开下拉菜单
     */
    toggleSelect(data, flag) {
      this.$set(data, 'showSelect', flag)
      if (data.showSelect) {
        try {
          this.$refs[`directSelect-${data.sortNum}`][0].$el.click()
        } catch (e) {
          console.error(e)
        }
      }
    },
    // 判断上传网络图 最多5个
    fileArrysData(val) {
      let that = this

      if (val.length > 4) {
        that.isClose = false
      } else {
        that.isClose = true
      }
    },

    // 查询第一责任人 姓名 电话 岗位
    getDatas(val) {
      let that = this

      that.infos = []

      // 根据岗位id 查询人员的电话 姓名
      if (val != '' && val != null) {
        getStaffAll({ postId: val }).then((res) => {
          if (res.data && res.data.length > 0) {
            let arr = []
            res.data.forEach(function (obj, i) {
              let item = {}
              item.name = obj.name
              item.phone = obj.phone

              arr.push(item)
            })

            var arrys = arr
              .map(function (objs, index) {
                return objs.name + ',' + objs.phone
              })
              .join(',')
            that.infos = arrys
          }
        })
      }
    },

    // 查询直接责任人 电话 岗位
    getPosts(val) {
      let that = this

      that.posts = []

      // 根据岗位id 查询人员的电话 姓名
      if (val != '' && val != null) {
        getOrgUserPosts({ employeeId: val }).then((ress) => {
          if (ress.code == 200 || ress.data.code == 200) {
            that.posts = [ress.data]
          }
        })
      }
    },
    handleCancels() {
      this.visible = false
    },
    // 刷新序号
    refreshIndex() {
      refreshSort({ planId: this.planId }).then((res) => {
        if (res.code == 200 || res.data.code == 200) {
          this.getconstructionPlan(true)
        }
      })
    },
    // 验证表格内的填写数据项
    handleValidateTables() {
      let flag = true
      const validateEmpty = (val) => {
        if (val === '' || val === undefined || val === null) {
          return false
        }
        return true
      }
      const validateTableData = (list) => {
        for (let i = 0; i < list.length; i++) {
          const record = list[i]
          if (record.level != '4' && !validateEmpty(record.name)) {
            this.$message.error('请完善阶段/类别')
            flag = false
            return
          }
          if (record.level == '4' && !validateEmpty(record.businessMatters)) {
            this.$message.error('请完善业务事项')
            flag = false
            return
          }
          if (record.level == '4' && !validateEmpty(record.controlLevelName)) {
            this.$message.error('请完善管控级别')
            flag = false
            return
          }
          if (record.level == '4' && !validateEmpty(record.duration)) {
            this.$message.error('请完善周期')
            flag = false
            return
          }
          if (record.level == '4' && !validateEmpty(record.startTime)) {
            this.$message.error('请完善计划开始时间')
            flag = false
            return
          }
          if (record.level == '4' && !validateEmpty(record.completeStandard)) {
            this.$message.error('请完善完成标准')
            flag = false
            return
          }
          if (record.level == '4' && !validateEmpty(record.verifyDoc)) {
            this.$message.error('请完善验证资料')
            flag = false
            return
          }
          if (record.level == '4' && !validateEmpty(record.firstResponsible)) {
            this.$message.error('请选择第一责任人')
            flag = false
          }
          if (record.level == '4' && !validateEmpty(record.directResPerName)) {
            this.$message.error('请完善直接责任人')
            flag = false
            return
          }
          record.children && validateTableData(record.children)
        }
      }
      validateTableData(this.tableData)
      return flag
    },
    handleCancelFirstRes() {
      this.bindOrgVisible = false
    },
    getProjects(id) {
      const params = {
        projectIds: [id]
      }
      getProjects(params).then((res) => {
        this.orgQuery.ids = res.data[0].orgId
      })
    },
    handleBind() {
      // console.log("当前数据：",record)
      let that = this
      that.bindOrgVisible = true
      // this.form = {}
    },
    handleOk(value) {
      let data = {
        id: this.selectedData.nodeId,
        level: this.selectedData.level,
        firstResId: value.jobsSelectedId,
        firstResName: value.jobsSelectedName
      }
      editPlan(data).then((res) => {
        this.bindOrgVisible = false
        if (res) {
          this.getconstructionPlan()
        }
      })
    },
    searchFiles() {
      let that = this
      searchFiles({ businessId: that.projectId }).then((res) => {
        if (res.data.code == 200) {
          that.form.fileList = []
        } else {
          that.form.fileList = res.data
        }
        if (that.form.fileList.length > 4) {
          that.isClose = false
        } else {
          that.isClose = true
        }
      })
    },
    getNodeControl() {
      getNodeControl().then((res) => {
        this.nodeList = res.data
      })
    },
    renderGantt() {
      if (this.isGanttDataOk) {
        return
      }
      gantt.clearAll()
      gantt.parse(this.ganttData)
      this.isGanttDataOk = true
    },
    buildGanttData(treeData, open) {
      const ganttData = {
        data: []
      }
      const readTreeData = (children, parent) => {
        children.forEach((c) => {
          const data = { ...c, id: c.id, type: c.children ? 'project' : '', parent, open }
          ganttData.data.push(this.valuesToTask(data))
          if (c.children && c.children.length > 0) {
            readTreeData(c.children, c.id, open)
          }
        })
      }
      readTreeData(treeData, null, open)
      return ganttData
    },

    // 获取模板
    getconstructionPlan(showLoading) {
      let that = this
      if (showLoading) {
        that.progressing = true
        that.progressingTips = '总计划加载中...'
      }
      getconstructionPlan(that.templateId)
        .then((res) => {
          if (showLoading) {
            if (that.type != 'view' && that.type != 'approve') {
              that.getOrganizePeopleList()
              that.getNodeControl()
              that.getProjects(res.data.projectId)
            }
            that.searchFiles()
          }

          that.plugins = {}
          that.total = res.data
          that.tableData = res.data.planDetailResultList || []
          that.tableData.forEach((item1) => {
            if (item1.children) {
              item1.children.forEach((item2) => {
                if (item2.children) {
                  item2.children.forEach((item3) => {
                    if (item3.children) {
                      item3.children.forEach((item4) => {
                        const area = {
                          label: item4.directResPerName,
                          key: item4.directResPerId
                        }
                        item4.directResPer = area

                        if (item4.controlLevelId == null) {
                          item4.controlLevelId = undefined
                        }
                        if (item4.directResPerId == null) {
                          item4.directResPer = undefined
                        }
                      })
                    }
                  })
                }
              })
            }
          })
          that.ganttData = that.buildGanttData(that.tableData, true)
          that.progressing = false
          that.progressingTips = ''
        })
        .catch(() => {
          that.progressing = false
          that.progressingTips = ''
        })
    },
    changeName(value) {},
    // 直接责任人查询
    getOrganizePeopleList() {
      let that = this
      that.loading = true
      getOrganizeUserList({ id: that.projectId }).then((res) => {
        that.responsLists = res.data
      })
    },
    // 修改直接责任人
    changeResponse(value) {
      console.log(value)
      let data = {}
      data = {
        id: this.selectedData.nodeId,
        level: this.selectedData.level,
        directResPerId: value.key,
        directResPerName: value.label
      }
      // 编辑之后不需要请求列表
      editPlan(data)
    },
    // 计划开始时间
    editstartDate(value, dateString) {
      let data = {
        id: this.selectedData.nodeId,
        level: this.selectedData.level,
        startTime: dateString
      }
      editPlan(data).then((res) => {
        if (res) {
          this.getconstructionPlan()
        }
      })
    },
    // 周期
    editduration(e) {
      const val = e.target.value
      this.saveSelectRows.duration = Math.floor(val)
      let duration = this.saveSelectRows.duration
      if (!duration) {
        duration = null
      }
      let data = {
        id: this.selectedData.nodeId,
        level: this.selectedData.level,
        duration: duration
      }
      if (duration != null) {
        editPlan(data).then((res) => {
          if (res) {
            this.getconstructionPlan()
          }
        })
      }
    },
    // 验证资料
    changeverifyDoc(e) {
      this.saveSelectRows.verifyDoc = e.target.value
      let data = {}
      data = {
        id: this.selectedData.nodeId,
        level: this.selectedData.level,
        verifyDoc: this.saveSelectRows.verifyDoc
      }
      editPlan(data).then((res) => {})
    },
    // 完成标准
    changecompleteStandard(e) {
      this.saveSelectRows.completeStandard = e.target.value
      let data = {}
      data = {
        id: this.selectedData.nodeId,
        level: this.selectedData.level,
        completeStandard: this.saveSelectRows.completeStandard
      }
      editPlan(data).then((res) => {})
    },
    // 管控节点
    changeLevel(value) {
      let data = {}
      data = {
        id: this.selectedData.nodeId,
        level: this.selectedData.level,
        controlLevelId: value
      }
      editPlan(data).then((res) => {})
    },
    // 时间标准
    changedateStandard(value) {
      let data = {}
      data = {
        id: this.selectedData.nodeId,
        level: this.selectedData.level,
        dateStandard: value
      }
      editPlan(data).then((res) => {
        if (res) {
          this.getconstructionPlan()
        }
        /*if(res.code=='200'){
            this.$message.success("修改成功")
          }*/
      })
    },
    // 业务事项
    onCellChangeBusiness(val) {
      this.selectedData.name = val
    },
    // 保存阶段名称
    blurData(e, record) {
      this.saveSelectRows.name = e.target.value
      let data = {}
      data = {
        id: this.selectedData.nodeId,
        level: this.selectedData.level,
        name: this.saveSelectRows.name
      }
      editPlan(data).then((res) => {
        if (res.code == '200') {
          this.$message.success('修改成功')
        }
      })
    },
    changeMatter(e, record) {
      this.saveSelectRows.businessMatters = e.target.value
      let data = {}
      data = {
        id: this.selectedData.nodeId,
        level: this.selectedData.level,
        name: this.saveSelectRows.businessMatters
      }
      editPlan(data).then((res) => {
        if (res.code == '200') {
          this.$message.success('修改成功')
        }
      })
    },
    // 模糊搜索
    handleSearch(value) {
      let result
      if (!value || value.indexOf('@') >= 0) {
        result = []
      } else {
        result = ['gmail.com', '163.com', 'qq.com'].map((domain) => `${value}@${domain}`)
      }
      this.emailList = result
    },
    handleSelectChange(value) {
      if (value == 1) {
        this.levelOption = 1
      } else if (value == 2) {
        this.levelOption = 2
      }
      this.form.setFieldsValue({
        note: value
      })
    },
    // 点击行
    clickRow(record, index) {
      const _this = this
      return {
        on: {
          click: () => {
            _this.selectId = record.nodeId
            _this.selectedData = record
            _this.rowClassNames(record)
            gantt.selectTask(record.nodeId)
          }
        }
      }
    },
    /**
     * 控制umi-table的点击
     */
    handleClickRow(record) {
      this.searchFiles()
      this.selectId = record.nodeId
      this.selectedData = record
      this.rowClassNames(record)
      gantt.selectTask(record.nodeId)
    },
    onCellChange(key, dataIndex, value) {
      const dataSource = [...this.dataSource]
      const target = dataSource.find((item) => item.key === key)
      if (target) {
        target[dataIndex] = value
        this.dataSource = dataSource
      }
    },
    onCellChangeDur(record, dataIndex, value) {
      // const start = record.start_date
      // const endDate = gantt.calculateEndDate({
      //   start_date: start,
      //   duration: value
      // })
      this.form.setFieldsValue({
        period: start.toDate()
      })

      const dataSource = [...this.dataSource]
      const target = dataSource.find((item) => item.key === key)
      if (target) {
        target[dataIndex] = value
        this.dataSource = dataSource
      }
    },
    onClose() {
      this.visible = false
    },
    showDrawer() {
      this.visible = !this.visible
      this.renderGantt()
    },
    afterVisibleChange(visible) {
      if (visible) {
        gantt.refreshData()
      }
    },
    getChildrenSize(p) {
      let size = 0
      const getChildSize = (p) => {
        if (p.type === 'task') {
          return
        }
        p.children.forEach((c) => {
          if (c.type === 'task') {
            size++
          }
          getChildSize(c)
        })
      }
      getChildSize(p)
      return size
    },
    rowExpand(expanded, task) {
      if (expanded) {
        gantt.open(task.nodeId)
      } else {
        gantt.close(task.nodeId)
      }
    },
    onTemplateDataImport(dataList, selectedTemplate, selectedStartDate) {
      const data = {
        children: dataList,
        id: this.selectedData.nodeId,
        level: this.selectedData.level,
        planId: this.templateId,
        parentId: this.selectedData.workPackId,
        startDate: selectedStartDate,
        templateId: selectedTemplate
      }
      this.progressing = true
      this.progressingTips = '模板导入中...'
      importTemplate(data)
        .then((res) => {
          this.progressingTips = ''
          this.progressing = false
          if (res.code == 200 || res.data.code == 200) {
            this.$message.success('导入成功')
            this.getconstructionPlan(true)
          }
        })
        .catch(() => {
          this.progressingTips = ''
          this.progressing = false
        })
    },
    importFromTemplate() {
      if (!this.selectedData) {
        this.$confirm({
          title: '提示！！',
          content: '请选中任务',
          okText: '确定',
          cancelText: '取消',
          onOk() {
            return false
          },
          onCancel() {
            return false
          }
        })
      } else {
        this.taskTemplateVisible = true
      }
    },
    importFromTemplateHide() {
      this.taskTemplateVisible = false
    },
    parentFilterOption(input, option) {
      return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
    },
    onTaskTypeChange(val) {
      this.taskType = val
    },
    getPopupContainer(triggerNode) {
      return document.body
    },
    // getPopupContainer(triggerNode){
    //   return  triggerNode.parentNode
    // },
    getPeriod() {
      this.startDates = this.form.getFieldValue('period')
    },
    handleCancel() {
      this.confirmLoading = false
      this.addVisible = false
    },
    valuesToTask(values) {
      const _this = this
      return {
        id: values.id || values.nodeId,
        parent: values.parent,
        text: values.name || values.businessMatters,
        name: values.name,
        businessMatters: values.businessMatters,
        start_date: values.start_date || values.startTime || _this.today,
        startDate: values.startDate || values.startTime || _this.today,
        end_date: values.end_date || values.endTime || _this.today,
        endDate: values.endDate || values.endTime || _this.today,
        duration: values.duration,
        parentId: values.workPackId,
        type: values.type,
        preTask: values.preTask,
        matters: values.businessMatters,
        levelType: values.levelType,
        responsible: values.responsible,
        firstResponsible: values.firstResponsible,
        level: values.level,
        nodeId: values.nodeId,
        workPackId: values.workPackId,
        open: values.open
      }
    },
    // 新增同级节点
    addSameNode(task) {
      let _this = this
      _this.confirmLoadings = true
      this.$confirm({
        okText: '确定',
        cancelText: '取消',
        title: '确定新增同级节点?',
        onOk() {
          addSameNode({ id: _this.selectedData.nodeId, level: _this.selectedData.level }).then((res) => {
            if ((res.code = '200')) {
              _this.confirmLoadings = false
              _this.getconstructionPlan()
              _this.$message.success('新增成功')
            } else {
              _this.$message.error('新增失败')
            }
          })
        },
        onCancel() {
          console.log('Cancel')
          _this.confirmLoadings = false
        },
        class: 'test'
      })
    },
    // 新增下级节点
    addNextNode() {
      let _this = this
      if (_this.selectedData.level == '4') {
        _this.$message.error('此节点不可新增下级节点')
        return
      }
      _this.confirmLoadings = true
      this.$confirm({
        okText: '确定',
        cancelText: '取消',
        title: '确定新增下级节点?',
        onOk() {
          let list = {}
          addDownNode({ id: _this.selectedData.nodeId, level: _this.selectedData.level })
            .then((res) => {
              if (res) {
                _this.getconstructionPlan()
              }
              _this.confirmLoadings = false
              if ((res.code = '200')) {
                _this.$message.success('新增成功')
                list = res.data
              } else {
                _this.$message.error(res.message || '新增失败，请稍后重试！')
              }
            })
            .catch(() => {
              _this.confirmLoadings = false
            })
        },
        onCancel() {
          console.log('Cancel')
          _this.confirmLoadings = false
        },
        class: 'test'
      })
    },
    handleSubmit() {
      this.confirmLoading = true
      this.form.validateFields((err, values) => {
        if (!err) {
          this.addVisible = false
          const start = this.selectedData.start_date
          const duration = this.selectedData.duration
          const end = this.selectedData.start_date
          const parent = this.selectedData.parent
          values.start_date = start
          values.duration = duration
          values.text = ' '

          let data = {}
          //新增同级节点
          if (this.levelOption === 1) {
            addSameNode({ id: this.selectedData.nodeId, level: this.selectedData.level }).then((res) => {
              if (res) {
                this.getconstructionPlan()
              }
              if (res.code == '200') {
                this.$message.success('新增成功')
              }
            })
          } else if (this.levelOption === 2) {
            // 新增下级节点
            let list = {}
            if (this.selectedData.level == '1' || this.selectedData.level == '2' || this.selectedData.level == '3') {
              addDownNode({ id: this.selectedData.nodeId, level: this.selectedData.level }).then((res) => {
                if (res) {
                  this.getconstructionPlan()
                }
                if (res.code == '200') {
                  this.$message.success('新增成功')
                  list = res.data
                }
              })
            } else {
              this.$message.error('此节点不可新增下级节点')
            }
          }
        }
      })
    },
    action(name) {
      // if('moveUp'===name){
      let that = this
      let task_id = gantt.getSelectedId()
      // that.$refs.ganttCom.action(name)
      // }

      // 升级
      if ('outdent' === name) {
        if (!that.selectedData) {
          that.$message.error('请选择节点')
        } else {
          let data = {}
          data = {
            positionTypeEnum: 2,
            level: that.selectedData.level,
            id: that.selectedData.nodeId,
            planId: that.templateId
          }
          if (that.selectedData.level == '1') {
            that.$message.error('此节点不能升级')
          } else {
            that.confirmLoadings = true
            editNodePosition(data)
              .then((res) => {
                if (res) {
                  that.getconstructionPlan()
                  that.selectedData = null
                }
                that.confirmLoadings = false
                if (res.code == '200') {
                  that.$message.success('升级成功')
                }
              })
              .catch(() => {
                that.confirmLoadings = false
              })
          }
        }
      }

      // 降级
      if ('indent' === name) {
        if (!that.selectedData) {
          that.$message.error('请选择节点')
        } else {
          if (that.selectedData.level == '4') {
            that.$message.error('此节点不能降级')
          } else {
            let data = {}
            data = {
              positionTypeEnum: 3,
              level: that.selectedData.level,
              id: that.selectedData.nodeId,
              planId: that.templateId
            }
            that.confirmLoadings = true
            editNodePosition(data)
              .then((res) => {
                that.confirmLoadings = false
                if (res) {
                  that.getconstructionPlan()
                  that.selectedData = null
                }
                if (res.code == '200') {
                  that.$message.success('降级成功')
                }
              })
              .catch(() => {
                that.confirmLoadings = false
              })
          }
        }
      }

      // 上移
      if ('moveUp' === name) {
        if (!that.selectedData) {
          that.$message.error('请选择节点')
        } else {
          let data = {}
          data = {
            positionTypeEnum: 0,
            level: that.selectedData.level,
            id: that.selectedData.nodeId
          }
          if (that.selectedData.nodeOrder == '0' || that.selectedData.nodeOrder == '2') {
            that.$message.error('不能上移')
          } else {
            that.confirmLoadings = true
            editNodePosition(data)
              .then((res) => {
                that.confirmLoadings = false
                if (res) {
                  that.getconstructionPlan()
                }
                if (res.code == '200') {
                  that.$message.success('上移成功')
                  that.selectedData = null //res.data
                }
              })
              .catch(() => {
                that.confirmLoadings = false
              })
          }
        }
      }

      // 下移
      if ('moveDown' === name) {
        if (!that.selectedData) {
          that.$message.error('请选择节点')
        } else {
          let data = {}
          data = {
            positionTypeEnum: 1,
            level: that.selectedData.level,
            id: that.selectedData.nodeId
          }
          if (that.selectedData.nodeOrder == '1' || that.selectedData.nodeOrder == '2') {
            that.$message.error('不能下移')
          } else {
            that.confirmLoadings = true
            editNodePosition(data)
              .then((res) => {
                that.confirmLoadings = false
                if (res) {
                  that.getconstructionPlan()
                }

                if (res.code == '200') {
                  that.$message.success('下移成功')
                  that.selectedData = null //res.data
                }
              })
              .catch(() => {
                that.confirmLoadings = false
              })
          }
        }
      }

      // 删除节点
      if ('del' === name) {
        // let task_id = gantt.getSelectedId()
        // console.log(task_id)
        // if (!task_id) {
        //   that.$message.warn('请先选择要删除的节点')
        //   return
        // }
        if (!that.selectedData) {
          that.$message.warn('请选择节点')
        } else {
          if (
            (that.tableData.length == 1 && !that.tableData[0].children) ||
            (that.tableData.length == 1 && that.selectedData.nodeId == that.tableData[0].nodeId)
          ) {
            that.$message.error('不能删除')
          } else {
            that.$confirm({
              okText: '删除',
              okType: 'danger',
              cancelText: '取消',
              title: '删除当前选择的节点?',
              onOk() {
                return new Promise((resolve, reject) => {
                  let data = {
                    level: that.selectedData.level,
                    id: that.selectedData.nodeId
                  }

                  deleteWork(data)
                    .then((res) => {
                      if (res.data.code == 200 || res.code == 200) {
                        that.selectedData = null
                        that.$message.success('节点删除成功')
                        that.getconstructionPlan()
                      }
                    })
                    .catch((e) => {
                      that.$message.error('节点删除失败')
                    })
                    .finally(() => {
                      resolve()
                    })
                  // that.$refs.ganttCom.action(name)
                })
              },
              onCancel() {},
              class: 'test'
            })
          }
        }
      } else {
        that.$refs.ganttCom.action(name)
      }
    },
    exportToPDFs() {
      gantt.exportToPDF({
        name: 'mygantt.pdf',
        header: '<h1>My company</h1>',
        footer: '<h4>Bottom line</h4>',
        locale: 'en',
        start: '01-04-2013',
        end: '11-04-2013',
        skin: 'terrace',
        data: {}
      })
    },

    selectTask: function (task) {
      console.log('当前选中行数据:', task)
      this.selectedTask = task
      // gantt.selectTask(task.id);
    },
    deleteTask: function (taskId) {
      this.selectedTask = task
      gantt.deleteTask(task.id)
    },
    logTaskUpdate(id, mode, task) {
      const text = task && task.text ? ` (${task.text})` : ''
      const message = `Task ${mode}: ${id} ${text}`
      this.addMessage(message)
    },
    logLinkUpdate(id, mode, link) {
      let message = `Link ${mode}: ${id}`
      if (link) {
        message += ` ( source: ${link.source}, target: ${link.target} )`
      }
      this.addMessage(message)
    },

    addModal(task) {
      this.confirmLoading = false
      const tasks = gantt.getTaskByTime()
      let parent = gantt.getSelectedId()
      this.addVisible = true
    },
    addMessage(message) {
      // let _this = this
      // _this.messages.unshift(message)
      // if (_this.messages.length > 40) {
      //   _this.messages.pop()
      // }
    },

    rowClassNames(record) {
      if (this.selectId == record.nodeId) {
        return 'clickRowStyle'
      }
    },
    validateTbale() {
      try {
        const validColumns = [
          {
            title: '阶段/类别',
            dataIndex: 'name'
          },
          {
            title: '业务事项',
            dataIndex: 'businessMatters'
          },
          {
            title: '管控级别',
            dataIndex: 'controlLevelId'
          },
          {
            title: '周期',
            dataIndex: 'duration'
          },
          {
            title: '计划开始时间',
            dataIndex: 'startTime'
          },
          {
            title: '完成标准',
            dataIndex: 'completeStandard'
          },
          {
            title: '验证资料',
            dataIndex: 'verifyDoc'
          },
          {
            title: '第一责任人',
            dataIndex: 'firstResponsible'
          },
          {
            title: '直接责任人',
            dataIndex: 'directResPer'
          }
        ]
        const treeDeep = (list) => {
          if (!Array.isArray(list)) return
          list.forEach((item) => {
            validColumns.forEach((column) => {
              // 阶段/类型为第一级，特殊处理
              const validLevel = column.dataIndex === 'name' ? item.level !== 4 : item.level === 4
              if (validLevel && !item[column.dataIndex] && item[column.dataIndex] !== 0) {
                this.$message.warning(`请完善编号${item.index}的${column.title}`)
                throw new Error('break')
              }
            })
            if (item.children) {
              treeDeep(item.children)
            }
          })
        }
        // 因为获取到的数据可能包含展开的节点，因此需要过滤不是第一级的节点
        const realTableData = (this.$refs.bigDataTable.getUTreeData() || []).filter((item) => item.level === 1)
        treeDeep(realTableData)
        return true
      } catch (e) {
        console.error(e)
        return false
      }
    },
    submitForm() {
      // if(!this.handleValidateTable()) return
      if (this.confirmLoadings) return
      this.confirmLoadings = true
      this.progressing = true
      if (!this.validateTbale()) {
        this.confirmLoadings = false
        this.progressing = false
        return
      }
      if (!this.form.fileList || !this.form.fileList.length) {
        this.$message.warning('请上传业主/监理签确计划及双代号网络图')
        this.confirmLoadings = false
        this.progressing = false
        return
      }
      this.progressingTips = '施工总计划提交中...'
      submitAudit({ projectId: this.projectId })
        .then((res) => {
          this.confirmLoadings = false
          this.progressing = false
          this.progressingTips = ''
          if (res && res.data && res.data.success) {
            this.$message.success('提交成功')
            this.$multiTab.close(this.$route.fullpath)
          } else {
            this.$message.warning('提交失败，请稍后重试！')
          }
        })
        .catch(() => {
          this.progressing = false
          this.progressingTips = ''
          this.confirmLoadings = false
          this.$message.error('提交失败，请稍后重试！')
        })
    },
    saveDraft() {
      // if(!this.handleValidateTable()) return
      this.$message.success('保存成功')
      this.$multiTab.close(this.$route.fullpath)
    },
    goBack() {
      this.$multiTab.close(this.$route.fullpath)
    }
  }
}
</script>
<style lang="less" scoped>
@deep: ~'>>>';
@{deep} .plTableBox .el-table td {
  padding: 2px 0;
  border-right: 0;
  height: 40px!important;
}
@{deep} .plTableBox .el-table th{
 padding: 8px 0;
}
.table-form-box {
  height: 42px;
  line-height: 42px;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-all;
  @{deep} textarea.ant-input {
    height: 42px !important;
    min-height: 42px !important;
    padding: 1px 10px;
  }
}
</style>
<style scoped>
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}
.ant-modal-dragmodal.modal-box /deep/ .ant-modal-mask {
  background: none !important;
}
/deep/ .ant-table-body .clickRowStyle {
  background-color: rgb(230, 243, 252);
}
/deep/ .ant-pro-basicLayout-children-content-wrap {
  flex: 1;
}
.gantt-layout {
  position: relative;
}
/deep/ .ant-table-thead th {
  height: 60px;
  line-height: 60px;
  padding: 0;
}
/deep/ .ant-table-placeholder {
  height: 600px;
}
/deep/ .gantt-layout .ant-table-body {
  min-height: 600px;
}
/deep/ .ant-drawer-content-wrapper {
  box-shadow: none !important;
}
/deep/ .ant-table-selection-column {
  width: 40px;
}

.button-bar {
  margin-bottom: 10px;
  /* position:fixed;
    top:200px; */
}

.button-bar > button:not(:first-child) {
  margin-left: 10px;
}
/deep/ .ant-modal-body {
  padding: 0;
}
td {
  display: flex;
}
/deep/ .ant-select:not(.ant-pagination-options-size-changer) .ant-select-selection,
.ant-input-number {
  height: 28px !important;
}
/deep/ .ant-select-selection,
.ant-input-number {
  height: 28px !important;
}

input[type='text'],
input[type='password'],
input[type='number'],
textarea {
  height: 28px;
}
.ant-calendar-picker {
  width: 100%;
  height: 28px;
}
.ant-cascader-picker {
  width: 120px;
  height: 28px;
}
form .ant-select,
form .ant-cascader-picker {
  width: 100%;
  height: 28px;
}
/deep/ .ant-table-tbody > tr > td {
  padding: 5px !important;
  padding-bottom: 10px !important;
}
</style>
